//
//  fans_C2.m
//  K-Music
//
//  Created by CHUN on 16/1/15.
//  Copyright © 2016年 CHUN. All rights reserved.
//

#import "fans_C2.h"
#import "person_fansCell.h"
#import "fans_Model.h"


@interface fans_C2 ()<UITableViewDelegate ,UITableViewDataSource>

@property (nonatomic ,strong) UITableView *fans_C2_TableView;

@end

@implementation fans_C2

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = RGB(241, 241, 241);
    
    self.navigationItem.title = @"我的粉丝";
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"back" highIcon:@"back" target:self action:@selector(back_back)];
    
    [self creatUI];
    
}

- (void)back_back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -creatUI-
- (void)creatUI
{
    self.fans_C2_TableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT+49) style:UITableViewStylePlain];
    self.fans_C2_TableView.delegate = self;
    self.fans_C2_TableView.dataSource =self;
    self.fans_C2_TableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.fans_C2_TableView.backgroundColor = RGB(241, 241, 241);
    [self.view addSubview:self.fans_C2_TableView];
    
}

#pragma mark -UITableViewDataSource-

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [User_information conversion].fans_Data.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellID = @"cellID";
    person_fansCell * fansCell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (fansCell == nil) {
        fansCell = [[person_fansCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        [fansCell creatUI];
    }
    
    fans_Model * data = [[User_information conversion].fans_Data objectAtIndex:indexPath.row];
    
    [fansCell.icon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",data.avatar]]];
    fansCell.icon.layer.cornerRadius= 30;
    fansCell.icon.layer.masksToBounds = YES;
    
    
    fansCell.titleName.text = data.nickName;
    fansCell.fans_Attention.text = [NSString stringWithFormat:@"粉丝:%@ 人关注",data.fanNumber];
    fansCell.singerLevelDesc.text = [NSString stringWithFormat:@"%@ ",data.singerLevelDesc] ;
    
    return fansCell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:tableView.indexPathForSelectedRow animated:YES];
}



@end
